import { Define, EntityObjectFactory } from 'tiny-entity2';
const EntityObjectType = EntityObjectFactory.GetEntityObjectType(process.env.dataBaseType || 'mysql');
@Define.Table({ TableName: "message" })
export class Message extends EntityObjectType<Message>{
    @Define.PrimaryKey()
    id: string;

    @Define.Column({
        DataType: Define.DataType.VARCHAR
    })
    name: string;

    @Define.Column({
        DataType: Define.DataType.VARCHAR
    })
    title: string;

    @Define.Column({
        DataType: Define.DataType.TEXT
    })
    body: string;

    @Define.Column({
        DataType: Define.DataType.BIGINT
    })
    createTime: number;

    @Define.Column({
        DataType: Define.DataType.BIGINT
    })
    updateTime: number;

    @Define.Column({
        DataType: Define.DataType.VARCHAR
    })
    status: string;

    @Define.Column({
        DataType: Define.DataType.VARCHAR
    })
    type: string;

    @Define.Column({
        DataType: Define.DataType.VARCHAR
    })
    orgId: string;

    @Define.Column({
        DataType: Define.DataType.VARCHAR
    })
    senderId: string;

    @Define.Column({
        DataType: Define.DataType.JSON
    })
    sender: any;

    @Define.Column({
        DataType: Define.DataType.VARCHAR
    })
    objectId: string;

    @Define.Column({
        DataType: Define.DataType.VARCHAR
    })
    objectType: string;

    @Define.Column({
        DataType: Define.DataType.VARCHAR
    })
    dataRegisterId: string;

    @Define.Column({
        DataType: Define.DataType.JSON
    })
    receiverIds: string[];

    @Define.Column({
        DataType: Define.DataType.JSON
    })
    conditionSentence: string;

    @Define.Column({
        DataType: Define.DataType.BIGINT
    })
    beginTime: number;

    @Define.Column({
        DataType: Define.DataType.BIGINT
    })
    endTime: number;
}

export const MessageType = {
    TaskMsg: 'taskMsg',
    TaskWarning: 'taskWarning',
    NotificationMsg: 'notificationMsg'
}

export const MessageStatus = {
    UnDo: 'undo',
    Closed: 'closed'
}